from django.db import models


# Create your models here.
class User(models.Model):
    username = models.CharField(max_length=48, verbose_name='用户名', unique=True)
    password = models.CharField(max_length=128, verbose_name='密码')

    class Meta:
        db_table = 'User'


class Weibo(models.Model):
    TYPE_CHOICES = (
        (1, "WB"),
        (2, "QQ"),
        (3, "DD"),
    )

    uid = models.CharField(max_length=32, verbose_name="微博uid")
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    type = models.SmallIntegerField(choices=TYPE_CHOICES, default=1)

    class Meta:
        db_table = "weibobind"

    def __str__(self):
        return "{} <--> {}".format(self.uid, self.user.id)
